local localCtrl = UIManager.Controller(UIManager.ControllerName.SecondPanel, UIManager.ViewName.SecondPanel)

-- ui bind function implementation
local function BackButtonOnClick()
    localCtrl:destroy()
end

local function PopupButtonOnClick()
    UIManager.openController(UIManager.ControllerName.PopupDialog)

    ResourceLoader.LoadAsset("Material/Character1")  
end

local function onSceneLoadStart()
    --UIManager.openController(UIManager.ControllerName.Loading)
    Debug.Log("loading scene start")
end

local function onSceneLoadUpdate(p)
    --    Event.dispatch(Event.LOADING_UPDATE, p)
    Debug.Log(p)
end

local function onSceneLoadComplete()
    Debug.Log("loading scene complete")
end

local function onLoadError(errorMsg)
    Debug.Log("loading scene error!!!!")
end

local function LoadSceneButtonOnClick()
    SceneLoaderInstance:LoadScene("EmptyScene", false, onSceneLoadStart, onSceneLoadUpdate, onSceneLoadComplete, onLoadError)
end

function localCtrl:onCreat(data)
    view = localCtrl.View

    -- 绑定view的控件
    view.BackButton.onClick:AddListener(BackButtonOnClick)
    view.PopupButton.onClick:AddListener(PopupButtonOnClick)
    view.LoadSceneButton.onClick:AddListener(LoadSceneButtonOnClick)

    Debug.Log("onCreate SecondPanel controller")
end

function localCtrl:onOpen(data)
    Debug.Log("onOpen SecondPanel controller")
end

function localCtrl:onInteractive(active)
end

function localCtrl:onDestroy()

end